﻿//
// © Algobox Ltd - Benn Eichhorn
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using Algobox.Structure.Finance.Strategies.SpikeArb;
using System.Windows.Controls;
using Algobox.Structure.Finance.Strategies.Terrapin;
using Algobox.Structure.Finance.Strategies;
using Algobox.Structure.Finance.Strategies.Dastan;
using Algobox.Structure.Finance.Strategies.Moss;
using Algobox.Structure.Finance.Strategies.FractionPrototype;

namespace ZephyrLite
{
    public class ZephyrDataGridSorter : System.Collections.IComparer
    {
        public ZephyrDataGridSorter(ListSortDirection direction, DataGridColumn column)
        {
            _direction = direction;
            _column = column;
            _sortProperty = (string)column.SortMemberPath;
        }

        ListSortDirection _direction;
        DataGridColumn _column;
        string _sortProperty;

        public int Compare(object x, object y)
        {
            return 0;
        }

        public int Compare(FractionComponentDay x, FractionComponentDay y)
        {
            switch (_sortProperty)
            {
                case "SymbolA":
                    return _direction == ListSortDirection.Ascending ? x.SymbolA.CompareTo(y.SymbolA) : y.SymbolA.CompareTo(x.SymbolA);
                case "SymbolB":
                    return _direction == ListSortDirection.Ascending ? x.SymbolB.CompareTo(y.SymbolB) : y.SymbolB.CompareTo(x.SymbolB);
                default:
                    return 0;
            }            
        }
    }
}
